﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using HA.MT3DMS.DomainLayer;
namespace HA.ModFlow.Controls.MT3DMSWindows
{
    /// <summary>
    /// winGCGSolver.xaml 的交互逻辑
    /// </summary>
    public partial class winGCGSolver : Window
    {
        public winGCGSolver(GCGSolver gcg)
        {
            InitializeComponent();
            this._Gcg = (GCGSolver)gcg.Clone();
        }

        private GCGSolver _Gcg;

        public GCGSolver Gcg
        {
            get { return _Gcg; }          
        }
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {           
            if (this.chkRhs.IsChecked==true )
            {
                this.Gcg.NCRS = 0;
            }
            else
            {
                this.Gcg.NCRS = 1;
            }
            this._Gcg.ISOLVE = this.cboISOLVE.SelectedIndex + 1;
            this.DialogResult = true;
            this.Close();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            this.DataContext = this._Gcg;

              this.cboISOLVE.SelectedIndex =this._Gcg.ISOLVE-1;
            if (this.Gcg.NCRS == 0)
            {
                this.chkRhs.IsChecked = true;
            }
            else
            {
                this.chkFull.IsChecked = true;
            }
            if (this.Gcg.ISOLVE == 2)
            {
                this.btnACCL.IsEnabled = true;
            }
            else
            {
                this.btnACCL.IsEnabled = false;
            }
        }

        private void btnCancal_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void cboISOLVE_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (this .cboISOLVE .SelectedIndex+1 == 2)
            {
                this.btnACCL.IsEnabled = true ;
            }
            else
            {
                this.btnACCL.IsEnabled = false  ;
            }
        }
    }
}
